import Vue from "vue";

import Vant from "vant";
import "vant/lib/index.css";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./assets/main.css";
import { serverUrl } from "./utils/tools";

Vue.use(Vant);
Vue.config.productionTip = false;
// 全局定义事件总线
Vue.prototype.$eventBus = new Vue();
// 全局过滤器
Vue.filter("dalImg", (url) => {
  if (url) {
    if (url.startsWith("http")) {
      return url;
    }
    return serverUrl + url;
  }
  return "https://img1.baidu.com/it/u=1194993845,2571839031&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=364";
});

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
